﻿using System;
using System.Web.Mvc;
using LibraryHub.Core.Models.User;

namespace LibraryHub.Controllers
{
    public class OneUserController : Controller
    {
        public static UserModel CurrentUser { get; set; }

        public static AccessRightsEnum CurrentAccessRights
        {
            get
            {
                if (CurrentUser != null &&
                    Enum.IsDefined(typeof(AccessRightsEnum), (int)CurrentUser.Role))
                {
                    return (AccessRightsEnum)CurrentUser.Role;
                }
                return AccessRightsEnum.Anonymous;
            }
        }

        public ViewResult AccessDenied()
        {
            return View("AccessDenied");
        }
    }
}
